
import request from '@/utils/request'

const purchaseContractApi = {

  /**
   * 保存【采购合同】
   */
  insert(purchaseContract) {
    return request({
      url: '/zhaomeng/purchaseContract/insert',
      method: 'post',
      data: purchaseContract
    })
  },
  /**
   * 保存【采购合同】
   */
  insertBatch(purchaseContract) {
    return request({
      url: '/zhaomeng/purchaseContract/insertBatch',
      method: 'post',
      data: purchaseContract
    })
  },



  /**
  * 修改【采购合同】
  */
  update(purchaseContract) {
    return request({
      url: '/zhaomeng/purchaseContract/update',
      method: 'post',
      data: purchaseContract
    })
  },
  /**
  * 分页查询
  */
  finds(queryParam) {
    return request({
      url: '/zhaomeng/purchaseContract/finds',
      method: 'get',
      params: {
        'pageNum': queryParam.pageNum,
        'pageSize': queryParam.pageSize,
        'sortBy': queryParam.sortBy,
        'sortOrder': queryParam.sortOrder,
        'q': queryParam.q
      }
    })
  },
  findOptions(queryParam) {
    let find = '/zhaomeng/purchaseContract/find';
    return request({
      url: find,
      method: 'get',
      params: queryParam
    })
  },
  /**
  * 查看【采购合同】详情
  */
  get(id) {
    return request({
      url: '/zhaomeng/purchaseContract/get',
      method: 'get',
      params: {
        'id': id
      }
    })
  },

  /**
  * 删除单个【采购合同】
  */
  del(id) {
    return request({
      url: '/zhaomeng/purchaseContract/delete',
      method: 'post',
      params: {
        'id': id
      }
    })
  },

  /**
  * 批量删除【采购合同】
  */
  deleteBatch(ids) {
    return request({
      url: '/zhaomeng/purchaseContract/deleteBatch',
      method: 'post',
      data: ids
    })
  },


   /**
    * 提交工作流
    */
   submit(purchaseContract) {
     return request({
       url: '/zhaomeng/purchaseContract/submit',
       method: 'post',
       data: purchaseContract
     })
   },

   /**
    * 无流程 修改数据为结束状态
    */
   endProcess(purchaseContract){
     return request({
       url: '/zhaomeng/purchaseContract/endProcess',
       method: 'post',
       data: purchaseContract
     })
   },

   /**
    * 根据数据任务 渲染详情中表单信息
    *
    * @param purchaseContract
    * @returns {AxiosPromise}
    */
   getTasksTable(purchaseContract){
     return request({
       url: '/zhaomeng/purchaseContract/getTasksTable',
       method: 'post',
       data: purchaseContract
     })
   },

  /**
   * 催办
   */
  rushDo(businessKey){
    return request({
      url: `/activiti/process/instance/${businessKey}/reminder`,
      method: 'post'
    })
  },

  /**
   * 撤销
   */
  undo(undoForm){
    return request({
      url: `/activiti/process/instance/${undoForm.businessKey}/delete`,
      method: 'post',
      data: undoForm
    })
  },


  /**
   * 下载
   *
   * @param id
   * @returns {AxiosPromise}
   */
  download(id) {
    return request({
      url: '/zhaomeng/purchaseContract/download',
      method: 'get',
      responseType: 'blob',
      params: {
        'id': id
      }
    })
  },

  /**
   * 根据code 查询文件集合
   * @param businessCode
   * @returns {AxiosPromise}
   */
  findAllByBusinessCode(businessCode){
    return request({
      url: '/zhaomeng/purchaseContract/findAllByBusinessCode',
      method: 'get',
      params: {
        'businessCode': businessCode
      }
    })
  },
  /**
   * 导出excel
   *
   * @param queryParam
   */
  exportExcel(queryParam) {
    return request({
      url: '/zhaomeng/purchaseContract/exportExcel',
      method: 'get',
      responseType: 'blob',
      params: {
        'pageNum': queryParam.pageNum,
        'pageSize': queryParam.pageSize,
        'sortBy': queryParam.sortBy,
        'sortOrder': queryParam.sortOrder,
        'q': queryParam.q
      }
    })
  },
  /**
   * 导出excel
   *
   * @param queryParam
   */
  exportExcelAll(queryParam) {
    return request({
      url: '/zhaomeng/purchaseContract/exportExcelAll',
      method: 'get',
      responseType: 'blob',
      params: {
        'pageNum': queryParam.pageNum,
        'pageSize': queryParam.pageSize,
        'sortBy': queryParam.sortBy,
        'sortOrder': queryParam.sortOrder,
        'total': queryParam.total,
        'q': queryParam.q
      }
    })
  },
  importExcel(fileInfo){
    return request({
      url: '/zhaomeng/purchaseContract/importExcel',
      method: 'post',
      data: fileInfo
    })
  }


}

export default purchaseContractApi
